<template>
<view>
<swiper class="swi_box" indicator-dots="true" indicator-color="#333333" indicator-active-color="#ffffff" autoplay="true">
  <swiper-item v-for="(item, index) in partDet.img_str" :key="index" class="swi_item">
    <image mode="aspectFill" style="width:100%;height:100%;" :src="item"></image>
  </swiper-item>
</swiper>
<view class="det_box">
  <view class="ptit">{{partDet.title}}</view>
  <view class="ptime_tel">
    <view class="pitem time">{{partDet.createtime}}</view>
    <view class="pitem tel">{{partDet.tel}}<label class="tel_lab" @tap="tel">点击拨打</label></view>
  </view>
  <view class="pcontent">{{partDet.address}}</view>
  <view class="pcontent">{{partDet.content}}</view>
  <view class="img_tit">设备图片</view>
  <view class="imglist">
    <block v-for="(item, index) in partDet.img_str" :key="index">
      <image mode="widthFix" :src="item"></image>
    </block>
  </view>
</view>
</view>
</template>

<script>
var app = getApp();

export default {
  data() {
    return {
      partDet: ''
    };
  },

  components: {},
  props: {},

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    var id = options.id;
    that.getDet(id);
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {},

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {},

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {},
  methods: {
    //获取详情信息
    getDet: function (e) {
      var that = this;
      app.globalData.util.request({
        url: "entry/wxapp/Api",
        data: {
          m: "monai_market",
          r: "home.index.pt_sbkdetial",
          id: e
        },
        cachetime: "0",
        success: function (res) {
          console.log('配件详情：', res.data);
          that.setData({
            partDet: res.data.data
          });
        }
      });
    },
    tel: function () {
      var that = this;
      wx.makePhoneCall({
        phoneNumber: that.partDet.tel,
        success: function () {}
      }); // if(that.data.is_mem=='0'){
      //     //非会员
      //     wx.showModal({
      //         title:'温馨提示',
      //         content:'您还不是会员，不能使用此功能。是否成为会员？',
      //         showCancel:true,
      //         success:function(e){
      //             if(e.confirm){
      //                 console.log('点击了确定');
      //                 wx.navigateTo({
      //                   url: '../../member/member',
      //                 })
      //             }else{
      //                 console.log('点击了取消');
      //             }
      //         }
      //     })
      // }else{
      //     //会员
      //     wx.makePhoneCall({
      //         phoneNumber: that.data.carInfo.phone,
      //         success: function() {}
      //     });
      // }
    }
  }
};
</script>
<style>
@import "./partDet.css";
</style>